package start;

import java.awt.Component;
import java.awt.Graphics;
import java.awt.Rectangle;

import java.beans.PropertyChangeListener;
import java.beans.PropertyEditor;

import org.springframework.beans.BeanWrapperImpl;
import org.springframework.beans.PropertyEditorRegistrar;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.validation.BeanPropertyBindingResult;
import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;

public class Main {
    public static void main(String[] args) {
        Errors errors=null;
        ApplicationContext ctx = new ClassPathXmlApplicationContext("META-INF\\beans.xml"); 
        Person p = (Person) ctx.getBean("person");
        p.setName("alex");
        BeanPropertyBindingResult result = new BeanPropertyBindingResult(p, "person");
        PersonValidator pv = (PersonValidator) ctx.getBean("pv");
        ValidationUtils.invokeValidator(pv, p, result);
        
        BeanWrapperImpl bwi = new BeanWrapperImpl(B.class);
        System.out.println(bwi.getPropertyValue("a.name"));
        
        D d = (D) ctx.getBean("d");
        
        
    }
}
